package com.boot.security.server.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.AppPaymentDetail;

@Mapper
public interface AppPaymentDetailDao {

    @Select("select * from app_payment_detail t where t.id = #{id}")
    AppPaymentDetail getById(Long id);

    @Delete("delete from app_payment_detail where id = #{id}")
    int delete(Long id);

    int update(AppPaymentDetail appPaymentDetail);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into app_payment_detail(fid, paymentid, paymentdetailid, recipeno, tradeno, groupid, recipetdate, recipettype, itemno, itemtype, itemname, feelevel, unitprice, count, fee, specificatio, unit, usages, dose, doseage, packages, days, patientid, times, hostcode) values(#{fid}, #{paymentid}, #{paymentdetailid}, #{recipeno}, #{tradeno}, #{groupid}, #{recipetdate}, #{recipettype}, #{itemno}, #{itemtype}, #{itemname}, #{feelevel}, #{unitprice}, #{count}, #{fee}, #{specificatio}, #{unit}, #{usages}, #{dose}, #{doseage}, #{packages}, #{days}, #{patientid}, #{times}, #{hostcode})")
    int save(AppPaymentDetail appPaymentDetail);
    
    int count(@Param("params") Map<String, Object> params);

    List<AppPaymentDetail> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
